package com.PAT.problem;

import java.util.ArrayList;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: zjz
 * @Date: 2022/02/21/14:59
 * @Description:
 * @Target: 0 不知道為啥錯誤的
 */
public class 卖个萌 {

    /*
    * 每个用户请求，在一行中输出生成的表情。若用户选择的序号不存在，则输出 Are you kidding me? @\/@。

        输入样例：
        [╮][╭][o][~\][/~]  [<][>]
         [╯][╰][^][-][=][>][<][@][⊙]
        [Д][▽][_][ε][^]  ...
        4
        1 1 2 2 2
        6 8 1 5 5
        3 3 4 3 3
        2 10 3 9 3
        输出样例：
        ╮(╯▽╰)╭
        <(@Д=)/~
        o(^ε^)o
        Are you kidding me? @\/@
    *
    * */
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String ss0 = in.nextLine();
        String ss1 = in.nextLine();
        String ss2 = in.nextLine();

        int n = Integer.valueOf(in.nextLine());

        String[] sss = new String[n];
        for (int i = 0; i < n; i++) {
            sss[i] = in.nextLine();
        }

        String[] ss0s = getStrings(ss0);
        String[] ss1s = getStrings(ss1);
        String[] ss2s = getStrings(ss2);



        for (int i = 0; i < n; i++) {
            String[] s = sss[i].split(" ");
            boolean flag = false;
            String ss = "";
            for (int j = 0; j < s.length; j++) {
                int index = Integer.valueOf(s[j])-1;
                if (index>10){
                    flag = true;
                }
                if (j==0||j==4){
                    if (ss0s[index]!=null){
                        if (j==0){
                            ss+=ss0s[index];
                            ss+="(";
                        }else {
                            ss+=")";
                            ss+=ss0s[index];
                        }
                    }else {
                        flag = true;
                    }

                }else if (j==1||j==3){
                    if (ss1s[index]!=null){
                        ss+=ss1s[index];
                    }else {
                        flag = true;
                    }
                }else {
                    if (ss2s[index]!=null){
                        ss+=ss2s[index];
                    }else {
                        flag = true;
                    }
                }


            }

            if (flag == true){
                System.out.println("Are you kidding me? @\\/@");
                flag = false;
            }else {
                System.out.println(ss);
            }
        }



    }

    static String[] getStrings(String ss){
        String[] strings = new String[10];
        boolean flag = false;
        String tempString = "";
        int len = 0;
        for (int i = 0; i < ss.length(); i++) {

            if ('['==ss.charAt(i)) {
                tempString = "";
                flag = true;
            }else if (flag == true){
                if (']'==ss.charAt(i)){
                    flag = false;
                    strings[len++] = tempString;
                }else {
                    tempString += ""+ss.charAt(i);
                }
            }
        }

        return strings;
    }
}
